{% extends "bootstrap/base.html" %}
{% block title %}问答系统{% endblock %}
{% block head %}
    {{ super() }}
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="{{ url_for('static', filename = 'images/favicon.ico') }}"
          type="image/x-icon">
    <link type="text/css" rel="stylesheet" href={{ url_for('static',filename='css/base.css') }}/>
{% endblock %}
{% block navbar %}
    <div class="navbar navbar-default" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="{{ url_for('main.index') }}"><span class="glyphicon glyphicon-home"
                                                                            aria-hidden="true"></span> 首页</a>
                {% if user and user.userConfirmed==1 %}
                    <a class="navbar-brand" href="{{ url_for('main.question') }}">
                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 发布
                    </a>
                {% endif %}
            </div>
            <div class="navbar-collapse collapse pull-right">
                <ul class="nav navbar-nav">
                    {% if user %}
                        <li><a href="{{ url_for('main.profile') }}"><span class="glyphicon glyphicon-education"
                                                                     aria-hidden="true"></span> {{ user.userNickname }}的个人中心</a>
                        </li>
                        <li><a href="{{ url_for('center.logout') }}"><span class="glyphicon glyphicon-off"
                                                                    aria-hidden="true"></span> 注销</a></li>
                    {% else %}
                        <li><a href="{{ url_for('center.login') }}"><span class="glyphicon glyphicon-dashboard"
                                                                   aria-hidden="true"></span> 登录</a></li>
                        <li><a href="{{ url_for('center.register') }}"><span class="glyphicon glyphicon-registration-mark"
                                                                      aria-hidden="true"></span> 注册</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </div>
{% endblock %}

{% block content %}
    <div class="container">
        {% with messages = get_flashed_messages() %}
            {% if messages %}
                {#                <ul class=flashes>#}
                {% for message in messages %}
                    {#                        <li>{{ message }}</li>#}
                    <div class="alert alert-danger" role="alert">{{ message }}</div>
                {% endfor %}
                {#                </ul>#}
            {% endif %}
        {% endwith %}
        {% block page_content %}{% endblock %}
    </div>
    <hr>
    <div class="copyright">
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <span>Copyright © <a href="hoaprox@qq.com">hoaprox</a></span> |
                    <span><a href="https://github.com/commitsession" target="_blank">2014-2019</a></span>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block scripts %}
    <script src="https://code.jquery.com/jquery-3.4.0.min.js"></script>
{% endblock %}
